<?php
include './include/common.inc.php';
$perpage = 10;
$pagevar = "page";
$nowtime=time();
$q2 = $db->query("select id from ann where time>{$nowtime} or time=0");

$pages = new Fpage();
$pages->totalNums = $db->num_rows($q2);
$pages->perpageNum = $perpage;
$pages->pageVar = $pagevar;
$pages->jump_pageinputId = "jumppage";
$pagestr = $pages->showpages();
$page = ($$pagevar && is_numeric($$pagevar)) ? $$pagevar : 0;
$leftstart = $perpage * (max(0, $page - 1));
$q3 = $db->query("select * from ann where time > {$nowtime} or time=0 order by id desc limit {$leftstart},{$perpage} ");
$ann_list = array();
while ($row = $db->fetch_array($q3)) {
    $ann_list[] = $row;
}
unset($q3);
$tpl->assign("ann_list", $ann_list);
$tpl->assign("page", $pagestr);


$tpl->assign("title","公告");
$tpl->display("ann.html");
